#ifndef _COMPANY_H_
#define _COMPANY_H_

#include "rational.h"
#include "Employee.h"
#include "AVLTree.h"
#include "CompareEmployeeBySalary.h"

using namespace rational;
namespace DataStructuresWet1
{
class Company
{
public:
	Company ();
	Company (const Company& c);
	~Company ();
	int GetID() const;
	void Hire(Employee& employee);
	void Fire(int id);
	void UpdateSalary(Rational update);
	Rational GetHisghestSalary() const;
	Rational GetMedianSalary() const;
	void Merge(const Company &company);
	int GetOwnerID() const;
	const AVLTree<Employee>& GetEmployees() const;
	bool IsActive() const;
	Rational GetSalaryUpdate() const;
	static bool IsLegalCompanyID(int id);
	static bool IsLegalSalaryUpdate(Rational update);

protected:
	void UpdateHighestSalary();
	void UpdateMedianSalary();
	void ValidateActiveCompany() const;
	static int IDCounter;
	int ownerID;
	int id;
	Rational SalaryMul;
	AVLTree<Employee> Employees;
	Rational MedianSalary;
	Rational HighestSalary;
	CompareEmployeesBySalary cmpEmpBySalary;
};
}
#endif //_COMPANY_H_